package com.programmingteam.wallpaperslideshow.ui.fragments;

import android.app.AlertDialog;
import android.app.Dialog;
import android.content.DialogInterface;
import android.os.Bundle;
import android.support.v4.app.DialogFragment;

import com.programmingteam.wallpaperslideshow.R;

public class AlertDialogFragment extends DialogFragment 
{
	private static final String TITLE = "Wallpaper Slideshow - Places";
	private static final String MSG = "This is handy application for browsing interesting places all over the world! " +
			"Enable it by clicking in upper right corner to start browsing photos (they will become your phones wallpaper). " +
			"Select place you want to see " +
			"on map or simply watch what is nearby. Check recently seen places and have fun!";
	
	public static AlertDialogFragment newInstance(int title) {
		AlertDialogFragment frag = new AlertDialogFragment();
	    Bundle args = new Bundle();
	    args.putInt("title", title);
	    frag.setArguments(args);
	    return frag;
	}
	
	@Override
	public Dialog onCreateDialog(Bundle savedInstanceState) {
	    //int title = getArguments().getInt("title");
	
	    return new AlertDialog.Builder(getActivity())
	            .setIcon(R.drawable.icon)
	            .setTitle(TITLE)
	            .setMessage(MSG)
	            .setPositiveButton("Back",
	                new DialogInterface.OnClickListener() {
	                    public void onClick(DialogInterface dialog, int whichButton) {
	                    	//Implementacja po stronie ACTIVITY
	                        //((FragmentAlertDialog)getActivity()).doPositiveClick();
	                    	dialog.cancel();
	                    }
	                }
	            )
//	            .setNegativeButton(R.string.alert_dialog_cancel,
//	                new DialogInterface.OnClickListener() {
//	                    public void onClick(DialogInterface dialog, int whichButton) {
//	            			 //Implementacja po stronie ACTIVITY
//	                        ((FragmentAlertDialog)getActivity()).doNegativeClick();
//	                    }
//	                }
//	            )
	            .create();
	}
}
